package com.cjm.one.webmanager.controller.goods;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.entity.GoodsCommentTag;
import com.cjm.one.webmanager.service.goods.GoodsCommentTagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@Tag(name = "2-商品评论标签管理", description = "商品评论标签管理")
@RequestMapping("/manager/goods/comment/tag")
public class GoodsCommentTagController {
    @Resource
    private GoodsCommentTagService goodsCommentTagService;
    @GetMapping("/list")
    @Operation(summary = "分页查询")
    public Result<Page<GoodsCommentTag>> list(@RequestParam("current") Long current, @RequestParam("size") Long size, @RequestParam(name = "keyword",required = false) String keyword) {
        return goodsCommentTagService.list(current, size, keyword);
    }

    @DeleteMapping("/{id}")
    @Operation(summary = "删除")
    public Result<Boolean> delete(@PathVariable Long id) {
        return goodsCommentTagService.delete(id);
    }

    @PostMapping
    @Operation(summary = "保存")
    public Result<Boolean> save(@RequestBody GoodsCommentTag goodsCommentTag) {
        return goodsCommentTagService.save(goodsCommentTag);
    }

    @GetMapping("/{id}")
    @Operation(summary = "根据id查询")
    public Result<GoodsCommentTag> getById(@PathVariable Long id) {
        return goodsCommentTagService.getById(id);
    }

    @PutMapping
    @Operation(summary = "修改")
    public Result<Boolean> update(@RequestBody GoodsCommentTag goodsCommentTag) {
        return goodsCommentTagService.update(goodsCommentTag);
    }
}
